import request from '@/utils/request'

// 提交代驾订单.
export function submitDriverOrder(data) {
  return request({
    url: '/driver/order/addOrders',
    method: 'post',
    data: data
  })
}

// 获取代驾订单列表
export function getDriverOrders(status) {
  return request({
    url: '/driver/order/orders',
    method: 'get',
    params: { status } // 可根据状态筛选订单，如待接单、已接单等
  })
}

// 获取订单详情
export function getOrderDetail(orderId) {
  return request({
    url: `/driver/order/${orderId}`,
    method: 'get'
  })
}

// 判断是否已评价
export function getReviewByOrderId(orderId) {
  return request({
    url: `/driver/rating/getReviewByOrderId/${orderId}`,
    method: 'get'
  })
}

// 更新订单状态（如车主开始服务、完成服务等）
export function updateOrderStatus(orderId, status) {
  return request({
    url: `/driver/order/${orderId}/status`,
    method: 'put',
    data: { status }
  })
}

// 获取订单列表(用户)
export function listUserOrders() {
  return request({
    url: `/driver/order/listUserOrders`,
    method: 'get'
  })
}

// 获取订单列表(司机)
export function listDriverOrders(driverCode) {
  return request({
    url: `/driver/order/listDriverOrders/` + driverCode,
    method: 'get'
  })
}
// 车主抢单
export function grabOrder(orderId) {
  return request({
    url: `/driver/order/grabOrder/` + orderId,
    method: 'post'
  })
}
// 车主退单
export function cancelOrder(orderId) {
  return request({
    url: `/driver/order/cancelOrder/` + orderId,
    method: 'post'
  })
}
// 司机点击完成
export function completeOrder(orderId) {
  return request({
    url: `/driver/order/completeOrder/` + orderId,
    method: 'post'
  })
}
//用户取消
export function userCancelOrder(orderId) {
  return request({
    url: `/driver/order/userCancelOrder/` + orderId,
    method: 'post'
  })
}
//用户点击评价
export function userReviewOrder(data) {
  return request({
    url: `/driver/rating/userReviewOrder/`,
    method: 'post',
	data: data
  })
}
//判断司机是否注册
export function isDriver() {
  return request({
    url: `/driver/info/isDriver`,
    method: 'get'
  })
}
//驾照枚举
export function getDriverLicenseTypes() {
  return request({
    url: `/driver/info/getDriverLicenseTypes`,
    method: 'get'
  })
}
// 提交司机注册
export function submitDriverRegister(data) {
  return request({
    url: '/driver/info/register', // 司机模块的注册接口
    method: 'post',
    data: data
  });
}


